<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Gem::Uninstaller - rubygems: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link">Object
</div>

        
<div id="includes-section" class="nav-section">
  <h3>Included Modules</h3>

  <ul class="link-list">
    <li><a class="include" href="UserInteraction.html">Gem::UserInteraction</a>
    <li><a class="include" href="InstallerUninstallerUtils.html">Gem::InstallerUninstallerUtils</a>
  </ul>
</div>

        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-announce_deletion_of">#announce_deletion_of</a>
    <li ><a href="#method-i-default_spec_matches-3F">#default_spec_matches?</a>
    <li ><a href="#method-i-default_specs_that_match">#default_specs_that_match</a>
    <li ><a href="#method-i-path_ok-3F">#path_ok?</a>
    <li ><a href="#method-i-regenerate_plugins">#regenerate_plugins</a>
    <li ><a href="#method-i-remove">#remove</a>
    <li ><a href="#method-i-remove_all">#remove_all</a>
    <li ><a href="#method-i-remove_executables">#remove_executables</a>
    <li ><a href="#method-i-safe_delete">#safe_delete</a>
    <li ><a href="#method-i-uninstall">#uninstall</a>
    <li ><a href="#method-i-uninstall_gem">#uninstall_gem</a>
    <li ><a href="#method-i-warn_cannot_uninstall_default_gems">#warn_cannot_uninstall_default_gems</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Gem::Uninstaller">
    <h1 id="class-Gem::Uninstaller" class="class">
      class Gem::Uninstaller
    </h1>

    <section class="description">
    
<p>An <a href="Uninstaller.html"><code>Uninstaller</code></a>.</p>

<p>The uninstaller fires pre and post uninstall hooks.  Hooks can be added either through a rubygems_plugin.rb file in an installed gem or via a rubygems/defaults/#{RUBY_ENGINE}.rb or rubygems/defaults/operating_system.rb file.  See <a href="../Gem.html#method-c-pre_uninstall"><code>Gem.pre_uninstall</code></a> and <a href="../Gem.html#method-c-post_uninstall"><code>Gem.post_uninstall</code></a> for details.</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">



        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-bin_dir" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">bin_dir</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The directory a gem’s executables will be installed into</p>
              </div>
            </div>
          <div id="attribute-i-gem_home" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">gem_home</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The gem repository the gem will be installed into</p>
              </div>
            </div>
          <div id="attribute-i-spec" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">spec</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The <a href="Specification.html"><code>Gem::Specification</code></a> for the gem being uninstalled, only set during <a href="Uninstaller.html#method-i-uninstall_gem"><code>uninstall_gem</code></a></p>
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(gem, options = {})</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Constructs an uninstaller that will uninstall <code>gem</code></p>

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File rubygems/uninstaller.rb, line 48</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">gem</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-comment"># TODO: document the valid options</span>
  <span class="ruby-ivar">@gem</span>                = <span class="ruby-identifier">gem</span>
  <span class="ruby-ivar">@version</span>            = <span class="ruby-identifier">options</span>[<span class="ruby-value">:version</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Requirement</span>.<span class="ruby-identifier">default</span>
  <span class="ruby-ivar">@gem_home</span>           = <span class="ruby-constant">File</span>.<span class="ruby-identifier">realpath</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:install_dir</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">dir</span>)
  <span class="ruby-ivar">@plugins_dir</span>        = <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">plugindir</span>(<span class="ruby-ivar">@gem_home</span>)
  <span class="ruby-ivar">@force_executables</span>  = <span class="ruby-identifier">options</span>[<span class="ruby-value">:executables</span>]
  <span class="ruby-ivar">@force_all</span>          = <span class="ruby-identifier">options</span>[<span class="ruby-value">:all</span>]
  <span class="ruby-ivar">@force_ignore</span>       = <span class="ruby-identifier">options</span>[<span class="ruby-value">:ignore</span>]
  <span class="ruby-ivar">@bin_dir</span>            = <span class="ruby-identifier">options</span>[<span class="ruby-value">:bin_dir</span>]
  <span class="ruby-ivar">@format_executable</span>  = <span class="ruby-identifier">options</span>[<span class="ruby-value">:format_executable</span>]
  <span class="ruby-ivar">@abort_on_dependent</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:abort_on_dependent</span>]

  <span class="ruby-comment"># Indicate if development dependencies should be checked when</span>
  <span class="ruby-comment"># uninstalling. (default: false)</span>
  <span class="ruby-comment">#</span>
  <span class="ruby-ivar">@check_dev</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:check_dev</span>]

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:force</span>]
    <span class="ruby-ivar">@force_all</span> = <span class="ruby-keyword">true</span>
    <span class="ruby-ivar">@force_ignore</span> = <span class="ruby-keyword">true</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-comment"># only add user directory if install_dir is not set</span>
  <span class="ruby-ivar">@user_install</span> = <span class="ruby-keyword">false</span>
  <span class="ruby-ivar">@user_install</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:user_install</span>] <span class="ruby-keyword">unless</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:install_dir</span>]

  <span class="ruby-comment"># Optimization: populated during #uninstall</span>
  <span class="ruby-ivar">@default_specs_matching_uninstall_params</span> = []
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-path_ok-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">path_ok?</span><span
                                class="method-args">(gem_dir, spec)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Is <code>spec</code> in <code>gem_dir</code>?</p>

                              <div class="method-source-code" id="path_ok-3F-source">
            <pre><span class="ruby-comment"># File rubygems/uninstaller.rb, line 303</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">path_ok?</span>(<span class="ruby-identifier">gem_dir</span>, <span class="ruby-identifier">spec</span>)
  <span class="ruby-identifier">full_path</span>     = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-identifier">gem_dir</span>, <span class="ruby-string">&quot;gems&quot;</span>, <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">full_name</span>
  <span class="ruby-identifier">original_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-identifier">gem_dir</span>, <span class="ruby-string">&quot;gems&quot;</span>, <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">original_name</span>

  <span class="ruby-identifier">full_path</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">full_gem_path</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">original_path</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">full_gem_path</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-regenerate_plugins" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">regenerate_plugins</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Regenerates plugin wrappers after removal.</p>

                              <div class="method-source-code" id="regenerate_plugins-source">
            <pre><span class="ruby-comment"># File rubygems/uninstaller.rb, line 293</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">regenerate_plugins</span>
  <span class="ruby-identifier">latest</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">latest_spec_for</span>(<span class="ruby-ivar">@spec</span>.<span class="ruby-identifier">name</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">latest</span>.<span class="ruby-identifier">nil?</span>

  <span class="ruby-identifier">regenerate_plugins_for</span>(<span class="ruby-identifier">latest</span>, <span class="ruby-ivar">@plugins_dir</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-remove" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">remove</span><span
                                class="method-args">(spec)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <dl class="rdoc-list note-list"><dt>spec
<dd>
<p>the spec of the gem to be uninstalled</p>
</dd></dl>

                              <div class="method-source-code" id="remove-source">
            <pre><span class="ruby-comment"># File rubygems/uninstaller.rb, line 240</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">remove</span>(<span class="ruby-identifier">spec</span>)
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">path_ok?</span>(<span class="ruby-ivar">@gem_home</span>, <span class="ruby-identifier">spec</span>) <span class="ruby-operator">||</span>
         (<span class="ruby-ivar">@user_install</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">path_ok?</span>(<span class="ruby-constant">Gem</span>.<span class="ruby-identifier">user_dir</span>, <span class="ruby-identifier">spec</span>))
    <span class="ruby-identifier">e</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">GemNotInHomeException</span>.<span class="ruby-identifier">new</span> \
      <span class="ruby-node">&quot;Gem &#39;#{spec.full_name}&#39; is not installed in directory #{@gem_home}&quot;</span>
    <span class="ruby-identifier">e</span>.<span class="ruby-identifier">spec</span> = <span class="ruby-identifier">spec</span>

    <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">raise</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">FilePermissionError</span>, <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">base_dir</span> <span class="ruby-keyword">unless</span>
    <span class="ruby-constant">File</span>.<span class="ruby-identifier">writable?</span>(<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">base_dir</span>)

  <span class="ruby-identifier">safe_delete</span> { <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_r</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">full_gem_path</span> }
  <span class="ruby-identifier">safe_delete</span> { <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_r</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">extension_dir</span> }

  <span class="ruby-identifier">old_platform_name</span> = <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">original_name</span>

  <span class="ruby-identifier">gem</span> = <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">cache_file</span>
  <span class="ruby-identifier">gem</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">cache_dir</span>, <span class="ruby-node">&quot;#{old_platform_name}.gem&quot;</span>) <span class="ruby-keyword">unless</span>
    <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span> <span class="ruby-identifier">gem</span>

  <span class="ruby-identifier">safe_delete</span> { <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_r</span> <span class="ruby-identifier">gem</span> }

  <span class="ruby-keyword">begin</span>
    <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">RDoc</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">spec</span>).<span class="ruby-identifier">remove</span>
  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">NameError</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">gemspec</span> = <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">spec_file</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span> <span class="ruby-identifier">gemspec</span>
    <span class="ruby-identifier">gemspec</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">gemspec</span>), <span class="ruby-node">&quot;#{old_platform_name}.gemspec&quot;</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">safe_delete</span> { <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_r</span> <span class="ruby-identifier">gemspec</span> }
  <span class="ruby-identifier">announce_deletion_of</span>(<span class="ruby-identifier">spec</span>)

  <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">reset</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-remove_all" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">remove_all</span><span
                                class="method-args">(list)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Removes all gems in <code>list</code>.</p>

<p>NOTE: removes uninstalled gems from <code>list</code>.</p>

                              <div class="method-source-code" id="remove_all-source">
            <pre><span class="ruby-comment"># File rubygems/uninstaller.rb, line 233</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">remove_all</span>(<span class="ruby-identifier">list</span>)
  <span class="ruby-identifier">list</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">spec</span><span class="ruby-operator">|</span> <span class="ruby-identifier">uninstall_gem</span> <span class="ruby-identifier">spec</span> }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-remove_executables" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">remove_executables</span><span
                                class="method-args">(spec)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Removes installed executables and batch files (windows only) for <code>spec</code>.</p>

                              <div class="method-source-code" id="remove_executables-source">
            <pre><span class="ruby-comment"># File rubygems/uninstaller.rb, line 179</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">remove_executables</span>(<span class="ruby-identifier">spec</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">executables</span>.<span class="ruby-identifier">empty?</span>

  <span class="ruby-identifier">executables</span> = <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">executables</span>.<span class="ruby-identifier">clone</span>

  <span class="ruby-comment"># Leave any executables created by other installed versions</span>
  <span class="ruby-comment"># of this gem installed.</span>

  <span class="ruby-identifier">list</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">find_all</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">s</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">version</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">version</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">s</span>.<span class="ruby-identifier">executables</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">exe_name</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">executables</span>.<span class="ruby-identifier">delete</span> <span class="ruby-identifier">exe_name</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">executables</span>.<span class="ruby-identifier">empty?</span>

  <span class="ruby-identifier">executables</span> = <span class="ruby-identifier">executables</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">exec</span><span class="ruby-operator">|</span> <span class="ruby-identifier">formatted_program_filename</span> <span class="ruby-identifier">exec</span> }

  <span class="ruby-identifier">remove</span> = <span class="ruby-keyword">if</span> <span class="ruby-ivar">@force_executables</span>.<span class="ruby-identifier">nil?</span>
    <span class="ruby-identifier">ask_yes_no</span>(<span class="ruby-string">&quot;Remove executables:\n&quot;</span> \
               <span class="ruby-node">&quot;\t#{executables.join &quot;, &quot;}\n\n&quot;</span> \
               <span class="ruby-string">&quot;in addition to the gem?&quot;</span>,
               <span class="ruby-keyword">true</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@force_executables</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">remove</span>
    <span class="ruby-identifier">bin_dir</span> = <span class="ruby-ivar">@bin_dir</span> <span class="ruby-operator">||</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">bindir</span>(<span class="ruby-identifier">spec</span>.<span class="ruby-identifier">base_dir</span>)

    <span class="ruby-identifier">raise</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">FilePermissionError</span>, <span class="ruby-identifier">bin_dir</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">writable?</span> <span class="ruby-identifier">bin_dir</span>

    <span class="ruby-identifier">executables</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">exe_name</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">say</span> <span class="ruby-node">&quot;Removing #{exe_name}&quot;</span>

      <span class="ruby-identifier">exe_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span> <span class="ruby-identifier">bin_dir</span>, <span class="ruby-identifier">exe_name</span>

      <span class="ruby-identifier">safe_delete</span> { <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm</span> <span class="ruby-identifier">exe_file</span> }
      <span class="ruby-identifier">safe_delete</span> { <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm</span> <span class="ruby-node">&quot;#{exe_file}.bat&quot;</span> }
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">say</span> <span class="ruby-string">&quot;Executables and scripts will remain installed.&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-safe_delete" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">safe_delete</span><span
                                class="method-args">(&amp;block)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="safe_delete-source">
            <pre><span class="ruby-comment"># File rubygems/uninstaller.rb, line 369</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">safe_delete</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>
  <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPERM</span>
  <span class="ruby-identifier">e</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">UninstallError</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-identifier">e</span>.<span class="ruby-identifier">spec</span> = <span class="ruby-ivar">@spec</span>

  <span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-uninstall" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">uninstall</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Performs the uninstall of the gem.  This removes the spec, the <a href="../Gem.html"><code>Gem</code></a> directory, and the cached .gem file.</p>

                              <div class="method-source-code" id="uninstall-source">
            <pre><span class="ruby-comment"># File rubygems/uninstaller.rb, line 83</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">uninstall</span>
  <span class="ruby-identifier">dependency</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Dependency</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@gem</span>, <span class="ruby-ivar">@version</span>

  <span class="ruby-identifier">list</span> = []

  <span class="ruby-identifier">dirs</span> =
    <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">dirs</span> <span class="ruby-operator">+</span>
    [<span class="ruby-constant">Gem</span>.<span class="ruby-identifier">default_specifications_dir</span>]

  <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Specification</span>.<span class="ruby-identifier">each_spec</span> <span class="ruby-identifier">dirs</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spec</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">dependency</span>.<span class="ruby-identifier">matches_spec?</span> <span class="ruby-identifier">spec</span>

    <span class="ruby-identifier">list</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">spec</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">list</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">InstallError</span>, <span class="ruby-node">&quot;gem #{@gem.inspect} is not installed&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">default_specs</span>, <span class="ruby-identifier">list</span> = <span class="ruby-identifier">list</span>.<span class="ruby-identifier">partition</span>(<span class="ruby-operator">&amp;</span><span class="ruby-value">:default_gem?</span>)
  <span class="ruby-identifier">warn_cannot_uninstall_default_gems</span>(<span class="ruby-identifier">default_specs</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">list</span>)
  <span class="ruby-ivar">@default_specs_matching_uninstall_params</span> = <span class="ruby-identifier">default_specs</span>

  <span class="ruby-identifier">list</span>, <span class="ruby-identifier">other_repo_specs</span> = <span class="ruby-identifier">list</span>.<span class="ruby-identifier">partition</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spec</span><span class="ruby-operator">|</span>
    <span class="ruby-ivar">@gem_home</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">base_dir</span> <span class="ruby-operator">||</span>
      (<span class="ruby-ivar">@user_install</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">base_dir</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">user_dir</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">list</span>.<span class="ruby-identifier">sort!</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">list</span>.<span class="ruby-identifier">empty?</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">other_repo_specs</span>.<span class="ruby-identifier">any?</span>

    <span class="ruby-identifier">other_repos</span> = <span class="ruby-identifier">other_repo_specs</span>.<span class="ruby-identifier">map</span>(<span class="ruby-operator">&amp;</span><span class="ruby-value">:base_dir</span>).<span class="ruby-identifier">uniq</span>

    <span class="ruby-identifier">message</span> = [<span class="ruby-node">&quot;#{@gem} is not installed in GEM_HOME, try:&quot;</span>]
    <span class="ruby-identifier">message</span>.<span class="ruby-identifier">concat</span> <span class="ruby-identifier">other_repos</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">repo</span><span class="ruby-operator">|</span>
      <span class="ruby-node">&quot;\tgem uninstall -i #{repo} #{@gem}&quot;</span>
    }

    <span class="ruby-identifier">raise</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">InstallError</span>, <span class="ruby-identifier">message</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;\n&quot;</span>)
  <span class="ruby-keyword">elsif</span> <span class="ruby-ivar">@force_all</span>
    <span class="ruby-identifier">remove_all</span> <span class="ruby-identifier">list</span>

  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">list</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
    <span class="ruby-identifier">gem_names</span> = <span class="ruby-identifier">list</span>.<span class="ruby-identifier">map</span>(<span class="ruby-operator">&amp;</span><span class="ruby-value">:full_name</span>)
    <span class="ruby-identifier">gem_names</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot;All versions&quot;</span>

    <span class="ruby-identifier">say</span>
    <span class="ruby-identifier">_</span>, <span class="ruby-identifier">index</span> = <span class="ruby-identifier">choose_from_list</span> <span class="ruby-string">&quot;Select gem to uninstall:&quot;</span>, <span class="ruby-identifier">gem_names</span>

    <span class="ruby-keyword">if</span> <span class="ruby-identifier">index</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">list</span>.<span class="ruby-identifier">size</span>
      <span class="ruby-identifier">remove_all</span> <span class="ruby-identifier">list</span>
    <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">index</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">index</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">0</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">index</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">list</span>.<span class="ruby-identifier">size</span>
      <span class="ruby-identifier">uninstall_gem</span> <span class="ruby-identifier">list</span>[<span class="ruby-identifier">index</span>]
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">say</span> <span class="ruby-node">&quot;Error: must enter a number [1-#{list.size + 1}]&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">uninstall_gem</span> <span class="ruby-identifier">list</span>.<span class="ruby-identifier">first</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-uninstall_gem" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">uninstall_gem</span><span
                                class="method-args">(spec)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Uninstalls gem <code>spec</code></p>

                              <div class="method-source-code" id="uninstall_gem-source">
            <pre><span class="ruby-comment"># File rubygems/uninstaller.rb, line 149</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">uninstall_gem</span>(<span class="ruby-identifier">spec</span>)
  <span class="ruby-ivar">@spec</span> = <span class="ruby-identifier">spec</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">dependencies_ok?</span> <span class="ruby-identifier">spec</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">abort_on_dependent?</span> <span class="ruby-operator">||</span> <span class="ruby-operator">!</span><span class="ruby-identifier">ask_if_ok</span>(<span class="ruby-identifier">spec</span>)
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">DependencyRemovalException</span>,
        <span class="ruby-string">&quot;Uninstallation aborted due to dependent gem(s)&quot;</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">pre_uninstall_hooks</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">hook</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">hook</span>.<span class="ruby-identifier">call</span> <span class="ruby-keyword">self</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">remove_executables</span> <span class="ruby-ivar">@spec</span>
  <span class="ruby-identifier">remove_plugins</span> <span class="ruby-ivar">@spec</span>
  <span class="ruby-identifier">remove</span> <span class="ruby-ivar">@spec</span>

  <span class="ruby-identifier">regenerate_plugins</span>

  <span class="ruby-constant">Gem</span>.<span class="ruby-identifier">post_uninstall_hooks</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">hook</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">hook</span>.<span class="ruby-identifier">call</span> <span class="ruby-keyword">self</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-ivar">@spec</span> = <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Instance Methods</h3>
                </header>

                  <div id="method-i-announce_deletion_of" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">announce_deletion_of</span><span
                                class="method-args">(spec)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="announce_deletion_of-source">
            <pre><span class="ruby-comment"># File rubygems/uninstaller.rb, line 382</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">announce_deletion_of</span>(<span class="ruby-identifier">spec</span>)
  <span class="ruby-identifier">name</span> = <span class="ruby-identifier">spec</span>.<span class="ruby-identifier">full_name</span>
  <span class="ruby-identifier">say</span> <span class="ruby-node">&quot;Successfully uninstalled #{name}&quot;</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">default_spec_matches?</span>(<span class="ruby-identifier">spec</span>)
    <span class="ruby-identifier">say</span>(
      <span class="ruby-node">&quot;There was both a regular copy and a default copy of #{name}. The &quot;</span> \
        <span class="ruby-string">&quot;regular copy was successfully uninstalled, but the default copy &quot;</span> \
        <span class="ruby-string">&quot;was left around because default gems can&#39;t be removed.&quot;</span>
    )
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-default_spec_matches-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_spec_matches?</span><span
                                class="method-args">(spec)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>@return true if the specs of any default gems are ‘==` to the given `spec`.</p>

                              <div class="method-source-code" id="default_spec_matches-3F-source">
            <pre><span class="ruby-comment"># File rubygems/uninstaller.rb, line 395</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">default_spec_matches?</span>(<span class="ruby-identifier">spec</span>)
  <span class="ruby-operator">!</span><span class="ruby-identifier">default_specs_that_match</span>(<span class="ruby-identifier">spec</span>).<span class="ruby-identifier">empty?</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-default_specs_that_match" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_specs_that_match</span><span
                                class="method-args">(spec)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>@return [Array] specs of default gems that are ‘==` to the given `spec`.</p>

                              <div class="method-source-code" id="default_specs_that_match-source">
            <pre><span class="ruby-comment"># File rubygems/uninstaller.rb, line 400</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">default_specs_that_match</span>(<span class="ruby-identifier">spec</span>)
  <span class="ruby-ivar">@default_specs_matching_uninstall_params</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">default_spec</span><span class="ruby-operator">|</span> <span class="ruby-identifier">spec</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">default_spec</span> }
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-warn_cannot_uninstall_default_gems" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">warn_cannot_uninstall_default_gems</span><span
                                class="method-args">(specs)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="warn_cannot_uninstall_default_gems-source">
            <pre><span class="ruby-comment"># File rubygems/uninstaller.rb, line 404</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">warn_cannot_uninstall_default_gems</span>(<span class="ruby-identifier">specs</span>)
  <span class="ruby-identifier">specs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spec</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">say</span> <span class="ruby-node">&quot;Gem #{spec.full_name} cannot be uninstalled because it is a default gem&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

